﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Practices.Prism.MefExtensions;
using System.ComponentModel.Composition.Hosting;
using Eniux.Web.MVVM;
using Microsoft.Practices.Prism.Regions;
using Microsoft.Practices.Prism.Modularity;

namespace EniuxOS
{
    public class AppMefBootstrapper:MefBootstrapper
    {

        protected override DependencyObject CreateShell()
        {
            return this.Container.GetExportedValue<Shell>();
        }
        protected override void InitializeShell()
        {
            base.InitializeShell();
            Application.Current.RootVisual = (UIElement)this.Shell;
        }

        protected override void ConfigureAggregateCatalog()
        {
            base.ConfigureAggregateCatalog();
            this.AggregateCatalog.Catalogs.Add(new TypeCatalog(new[] { typeof(Shell) }));
            //this.AggregateCatalog.Catalogs.Add(new TypeCatalog(typeof(Shell)));//new[] {
            //    typeof(Shell),  // Add the shell to the catalog so that it can be retrieved afterwards in the CreateShell method. 
            //    typeof(AutoPopulateExportedViewsBehavior), // Region behavior for finding viewExports
            //    typeof(ModuleAView) // View of Module A.
            //}));        
        }

        //protected override IRegionBehaviorFactory ConfigureDefaultRegionBehaviors()
        //{
        //    var factory = base.ConfigureDefaultRegionBehaviors();
        //    factory.AddIfMissing("AutoPopulateExportedViewsBehavior", typeof(AutoPopulateExportedViewsBehavior));
        //    return factory;
        //}

        //protected override IModuleCatalog CreateModuleCatalog()
        //{
        //    return Microsoft.Practices.Prism.Modularity.ModuleCatalog.CreateFromXaml(new Uri("/Prism.Workshop.Shell;component/ModulesCatalog.xaml", UriKind.Relative));
        //}   
    }
}
